<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>评论管理</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="css/space.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/space.js"></script>
<script type="text/javascript">
$(function(){
	$.post("space/getAllPerByChiefId", function(data){
		data = jQuery.parseJSON(data);
		var html = "";

		for(var i=0; i<data.length; i++) {
			html += "<option value='" + data[i].periodicalId + "'>" + data[i].name +"</option>";
		}
		
		$("#periodical").append(html);
	});
});

$(function(){
	$("#periodical").change(function(){
		$.post("json/findByPeriodicalId", {value:$("#periodical option:selected").attr("value")}, function(data){
			var html = "";
			
			for(var i=data.perPeriodicals.length; i>0; i--) {
				html += "<option value=" + data.perPeriodicals[i-1].perPeriodicalId + ">第" + data.perPeriodicals[i-1].number +"期</option>";
			}
			
			$("#perPeriodical").append(html);
		});
	});
});
</script>
</head>

<body>
	<div class="all">
		<div class="bodyge-left">
			<div class="bodyge-left-a1"><span class="font-b">文章评论</span></div>
			<div>
			<form id="commentForm" action="admin/findComment" method="post">
				<div class="periodicalWarning">请先选择期刊</div>
				<div class="selectPer">选择期刊：
					<select id="periodical" name="periodical.periodicalId" onchange="selectPer()">
						<option value="0" selected>请选择期刊&nbsp;---&nbsp;</option>
					</select>
					&nbsp;&nbsp;&nbsp;&nbsp;
					<select id="perPeriodical" name="perPeriodicalId" onclick="isSelectPer()" onchange="selectNum()">
						<option value="0">请选择期刊号&nbsp;---&nbsp;</option>
					</select>
					&nbsp;&nbsp;
					<input type="button" onclick="commentSub()" class="inputStyle" value="查询" />
				</div>
				<table class="ma-tab" cellspacing="0px">
					<tr class="ma-tab-tr_a">
						<td class="ma-tab-td1">选择</td>
						<td class="ma-tab-td2"><div class="made-td2">文章标题</div></td>
						<td class="ma-tab-td3">评论内容</td>
						<td class="ma-tab-td4">时间</td>
						<td class="ma-tab-td5">操作</td>
					</tr>
					<c:forEach items="${ requestScope.comments }" var="comments">
					<tr class="ma-tab-tr_b">
						<td class="ma-tab-td1"><input class="commentId" name="commentId" type="checkbox" value="${ comments.commentId }" /></td>
						<td class="ma-tab-td2"><div class="made-td2">${ comments.artical.title }</div></td>
						<td class="ma-tab-td3">${ comments.content }</td>
						<td class="ma-tab-td4">${ comments.commDate }</td>
						<td class="ma-tab-td5"><a class="td-a" href="admin/deleteComment?commentId=${ comments.commentId }&value=2&perPeriodicalId=${ comments.artical.perPeriodicalId }">删除</a></td>
					</tr>
					</c:forEach>
				</table>
			</form>
			</div>
			<%--
			<div style="clear:both;">
				选择：<span onclick="checkAll('commentId')">全选</span>-
					<span onclick="checkAllNo('commentId')">全不选</span>-
					<span onclick="reserveCheck('commentId')">反选</span>
					<input id="comment" type="text" />
					<span><a onmouseover="getCheck()" onclick="delComment()">批量删除</a></span>
				<jsp:include page="/page2.jsp"></jsp:include>
			</div>
			--%>
		</div>
	</div>
</body>
</html>
